package com.feng.study.demo;

import com.google.common.collect.Maps;

import java.util.HashMap;

/**
 * @Author: Zeng ShaoYong
 * @Date: 2021-11-03
 * @Description:
 */
public class TestMap {
    public static void main(String[] args) {
        testMerge();

    }

    /**
     * merge()
     */
    private static void testMerge(){
        HashMap<Integer,Integer> map= Maps.newHashMap();
        map.put(1,11);
        System.out.println(map.get(1));
        map.merge(1,10,Integer::sum);
        System.out.println(map.get(1));

        map.merge(2,10,Integer::max);
        System.out.println(map.get(2));
    }
}
